﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Composite.Regions;
using Microsoft.Practices.Composite.UnityExtensions;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;
using EQual.Infrastructure;
using System.Collections.Specialized;
using WpfApplicationExperimental.DetailedControls;
using System.Configuration;
namespace EQual.MainModule
{

    public class EqualMainModule : IModule
    {
        private readonly IUnityContainer _container;
        private readonly IRegionManager _regionManager;

        public EqualMainModule(IUnityContainer container, IRegionManager regionManager)
        {
            _container = container;
            _regionManager = regionManager;
        }

        #region IModule Members

        public void Initialize()
        {
            this.RegisterViewsAndServices();
            _container.Resolve<MainController>().Run();

            MainNavigation.MainNavigationController NavigationController = this._container.Resolve<MainNavigation.MainNavigationController>();
            IRegion reg = _regionManager.Regions[RegionNames.NavigationRegion];
            reg.Add(NavigationController.navigationView);
        }

        protected void RegisterViewsAndServices()
        {

            _container.RegisterType<MainNavigation.MainNavigationController, MainNavigation.MainNavigationController>();
            _container.RegisterType<MainNavigation.INavigationView, EQual .MainModule .MainNavigation .OutlookTabControl>();
            _container.RegisterType<WpfApplicationExperimental.MainViewPresenter, WpfApplicationExperimental.MainViewPresenter>();
            _container.RegisterType<WpfApplicationExperimental.ItemsListView, WpfApplicationExperimental.DataGridAdapter>();
            _container.RegisterType<Documents.Presenters.IDocumentsController, Documents.Presenters.DocumentsController>();
            _container.RegisterType<Employees .Presenters .IEmployeesController ,Employees . Presenters.EmployeesController >();
            _container.RegisterType<Projects.Presenters.ProjectsController, Projects.Presenters.ProjectsController>();
            _container.RegisterType<Reviews.Presenters.ReviewsController, Reviews.Presenters.ReviewsController>();
            _container.RegisterType<Employees.Trainings.TrainingsController, EQual.MainModule.Employees.Trainings.TrainingsController>();
            _container.RegisterType<Documents.Forms.FormsController, EQual.MainModule.Documents.Forms.FormsController>();
            _container.RegisterType<QualityEvents.QualityComplaintsController, EQual.MainModule.QualityEvents.QualityComplaintsController>();
            _container.RegisterType<QualityEvents.QualityNonConformitiesController, EQual.MainModule.QualityEvents.QualityNonConformitiesController>();
            _container.RegisterType<EQual.MainModule.Employees.Presenters.WorkExperianceController, EQual.MainModule.Employees.Presenters.WorkExperianceController>();
            _container.RegisterType<EQual.MainModule.Audits.AuditsController, EQual.MainModule.Audits.AuditsController>();
            _container.RegisterType<EQual.MainModule.Employees.Proposals.ProposalsController, EQual.MainModule.Employees.Proposals.ProposalsController>();
        }

        #endregion
    }



}
